package com.bwie.user.controller;

import com.bwie.common.result.Result;
import com.bwie.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Slf4j
public class UserController {
    @Autowired
    private UserService userService;

    @Autowired
    private HttpServletRequest  request;

    @PostMapping("/findByPhone")
    public Result findByPhone(@RequestParam String phone){
        log.info("功能名称:手机号查询,请求URI:{},请求方式:{},请求参数:{}",
                request.getRequestURI(),
                request.getMethod(),
                phone);
        Result byPhone = userService.findByPhone(phone);
        log.info("功能名称:手机号查询,请求URI:{},请求方式:{},响应结果:{}",
                request.getRequestURI(),
                request.getMethod(),
                phone);
        return byPhone;
    }
}
